package com.iarc.base.helper

import com.iarc.base.bugly.BuglyUtils
import com.iarc.base.utils.AppUtil

/**
 * author:kanlulu
 * data  :5/13/21 1:45 PM
 **/
object CrashHandlers : Thread.UncaughtExceptionHandler {
    const val TAG = "CrashHandlers"

    fun init() {
        //设置该CrashHandler为程序的默认处理器
        Thread.setDefaultUncaughtExceptionHandler(this)
    }

    override fun uncaughtException(thread: Thread, throwable: Throwable) {
        BuglyUtils.reportErrorRestartException()
        AppUtil.restartApplication()
    }
}